1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.PropertyExpression; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gobject.ParamSpec; 31 private import gtk.Expression; 32 private import gtk.c.functions; 33 public import gtk.c.types; 34 35 36 /** 37 * A `GObject` property value in a `GtkExpression`. 38 */ 39 public class PropertyExpression : Expression 40 { 41 /** the main Gtk struct */ 42 protected GtkPropertyExpression* gtkPropertyExpression; 43 44 /** Get the main Gtk struct */ 45 public GtkPropertyExpression* getPropertyExpressionStruct(bool transferOwnership = false) 46 { 47 if (transferOwnership) 48 ownedRef = false; 49 return gtkPropertyExpression; 50 } 51 52 /** the main Gtk struct as a void* */ 53 protected override void* getStruct() 54 { 55 return cast(void*)gtkPropertyExpression; 56 } 57 58 /** 59 * Sets our main struct and passes it to the parent class. 60 */ 61 public this (GtkPropertyExpression* gtkPropertyExpression, bool ownedRef = false) 62 { 63 this.gtkPropertyExpression = gtkPropertyExpression; 64 super(cast(GtkExpression*)gtkPropertyExpression, ownedRef); 65 } 66 67 68 /** */ 69 public static GType getType() 70 { 71 return gtk_property_expression_get_type(); 72 } 73 74 /** 75 * Creates an expression that looks up a property. 76 * 77 * The object to use is found by evaluating the `expression`, 78 * or using the `this` argument when `expression` is `NULL`. 79 * 80 * If the resulting object conforms to `this_type`, its property named 81 * `property_name` will be queried. Otherwise, this expression's 82 * evaluation will fail. 83 * 84 * The given `this_type` must have a property with `property_name`. 85 * 86 * Params: 87 * thisType = The type to expect for the this type 88 * expression = Expression to 89 * evaluate to get the object to query or `NULL` to 90 * query the `this` object 91 * propertyName = name of the property 92 * 93 * Returns: a new `GtkExpression` 94 * 95 * Throws: ConstructionException GTK+ fails to create the object. 96 */ 97 public this(GType thisType, Expression expression, string propertyName) 98 { 99 auto __p = gtk_property_expression_new(thisType, (expression is null) ? null : expression.getExpressionStruct(true), Str.toStringz(propertyName)); 100 101 if(__p is null) 102 { 103 throw new ConstructionException("null returned by new"); 104 } 105 106 this(cast(GtkPropertyExpression*) __p); 107 } 108 109 /** 110 * Creates an expression that looks up a property. 111 * 112 * The object to use is found by evaluating the `expression`, 113 * or using the `this` argument when `expression` is `NULL`. 114 * 115 * If the resulting object conforms to `this_type`, its 116 * property specified by `pspec` will be queried. 117 * Otherwise, this expression's evaluation will fail. 118 * 119 * Params: 120 * expression = Expression to 121 * evaluate to get the object to query or `NULL` to 122 * query the `this` object 123 * pspec = the `GParamSpec` for the property to query 124 * 125 * Returns: a new `GtkExpression` 126 * 127 * Throws: ConstructionException GTK+ fails to create the object. 128 */ 129 public this(Expression expression, ParamSpec pspec) 130 { 131 auto __p = gtk_property_expression_new_for_pspec((expression is null) ? null : expression.getExpressionStruct(true), (pspec is null) ? null : pspec.getParamSpecStruct()); 132 133 if(__p is null) 134 { 135 throw new ConstructionException("null returned by new_for_pspec"); 136 } 137 138 this(cast(GtkPropertyExpression*) __p); 139 } 140 141 /** 142 * Gets the expression specifying the object of 143 * a property expression. 144 * 145 * Returns: the object expression 146 */ 147 public Expression getExpression() 148 { 149 auto __p = gtk_property_expression_get_expression(cast(GtkExpression*)gtkPropertyExpression); 150 151 if(__p is null) 152 { 153 return null; 154 } 155 156 return ObjectG.getDObject!(Expression)(cast(GtkExpression*) __p); 157 } 158 159 /** 160 * Gets the `GParamSpec` specifying the property of 161 * a property expression. 162 * 163 * Returns: the `GParamSpec` for the property 164 */ 165 public ParamSpec getPspec() 166 { 167 auto __p = gtk_property_expression_get_pspec(cast(GtkExpression*)gtkPropertyExpression); 168 169 if(__p is null) 170 { 171 return null; 172 } 173 174 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) __p); 175 } 176 }